package com.pinghua.mocha.basics.enumerate.fwct;

import com.coffee.core.CoffeeEnum;

public enum AbnormalTypeEnum implements CoffeeEnum<Integer> {
    Missed(1,"漏收"),

    Stay(2,"异常停留"),

    Speeding(3,"超速"),
    Overloading(4,"超载"),
    Filtration(5,"滤油滤水")

    ;
    private final Integer code;
    private final String label;

    AbnormalTypeEnum(Integer code, String label) {
        this.code = code;
        this.label = label;
    }

    @Override
    public Integer code() {
        return this.code;
    }

    @Override
    public String label() {
        return this.label;
    }


    public static AbnormalTypeEnum ofCode(Integer code) {
        for (AbnormalTypeEnum type : values()) {
            if (type.code.equals(code)) {
                return type;
            }
        }
        return null;
    }
}
